package Design;

public class SingletonObject {
    //创建SingletonObject 的一个对象
    private static SingletonObject singletonObject = new SingletonObject();

    public static SingletonObject getInstance() {

        return singletonObject;
    }

    //让构造函数为Private,这样该类就不会被实例化
    private void SingleObject(){}

    public void showMessage(){
        System.out.println("Hello World!");
     }

    }

